<template>
  <h5>子级组件</h5>
  <h5>age:{{ age }}</h5>
  <h5>length:{{ length }}</h5>
</template>
<script lang='ts'>
  import { computed, defineComponent, Ref, toRef } from 'vue';
  function useGetLength(age:Ref){
    return computed(()=>{
      return age.value.toString().length
    })
  }
  export default defineComponent({
    name:'ToRefChild',
    // props:['age']
    props:{
      age:{
        type:Number,
        require:true
      }
    },
    setup(props){
      const length = useGetLength(toRef(props,'age'))
      return{
        length
      }
    }
  })
</script>
<style scoped>
</style>